package usr

import (
	"sync"
	"xian-server/lib/database"
)

type BaseUsrId string

type BaseUsr struct {
	Id string `db:"id"`

	// 头像
	AvatarImg string `db:"avatar_img"`

	// 代码
	Code string `db:"code"`

	// 名称
	IsOk int8 `db:"is_ok"`
}

type BaseUsrSearch struct {
}

func (m BaseUsr) Table() string {
	return "base_usr"
}

func (m BaseUsr) INew() database.IModel {
	return m.New()
}

func (m BaseUsr) GetId() string {
	return m.Id
}

func (m BaseUsr) Database() string {
	return ""
}

func (m BaseUsr) New() *BaseUsr {
	return &BaseUsr{}
}

func (m BaseUsr) NewSplice() *[]BaseUsr {
	return &[]BaseUsr{}
}

var (
	instanceBaseUsrModel *BaseUsr
	onceBaseUsrModel     sync.Once
)

func NewBaseUsrModel() *BaseUsr {
	onceBaseUsrModel.Do(func() {
		instanceBaseUsrModel = &BaseUsr{}
	})
	return instanceBaseUsrModel
}
